﻿using Avalonia.Controls;
using iOSClub.App.Share;

namespace iOSClub.App.Desktop.ProjectDialogs;

public partial class UpdateProject : UserControl
{
    private readonly string _id;

    public UpdateProject(ProjectModel model)
    {
        InitializeComponent();
        NameBox.Text = model.Title;
        IntroduceBox.Text = model.Description;
        _id = model.Id;
    }

    public ProjectModel Done() => string.IsNullOrEmpty(NameBox.Text) || string.IsNullOrEmpty(IntroduceBox.Text)
        ? new ProjectModel()
        : new ProjectModel { Id = _id, Title = NameBox.Text, Description = IntroduceBox.Text };
}